package com.sinosoft.ptas.control;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;



import com.sinosoft.ptas.control.dto.MapData;
import com.sinosoft.ptas.service.MapService;
import com.sinosoft.ptas.system.commom.MapConstant;
import com.sinosoft.ptas.system.util.EntityListConverter;
import com.sinosoft.ptas.system.util.ResponseMapData;

@Controller  
@RequestMapping(value = "/map")  
public class MapController {
	
	@Autowired
	MapService mapService;
	
	/**
	 * 查询未申报地图信息
	 * 优：0良：1中：2差：3未审核：4未申报：5
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/retrieveMapInfornation.service",method=RequestMethod.POST)
	public ResponseMapData retrieveUnReportMapEntity(String type){
		List<MapData> mapList=null;
		Map<String, List<?>> map=null;
		if(type.equals(MapConstant.UNREPORT)){
			mapList = mapService.retrieveUnReportMapEntity();
			map = EntityListConverter.toMap("com.sinosoft.ptas.control.dto.MapData", mapList,"serialVersionUID");
		}else if(type.equals(MapConstant.UNAUDIT)){
			 mapList = mapService.retrieveUnAuditMapEntity();
			 map = EntityListConverter.toMap("com.sinosoft.ptas.control.dto.MapData", mapList,"serialVersionUID");
			
		}else if(type.equals(MapConstant.AMPLE)){
			 mapList = mapService.retrieveAmpleMapEntity();
			 map = EntityListConverter.toMap("com.sinosoft.ptas.control.dto.MapData", mapList,"serialVersionUID");
		}else if(type.equals(MapConstant.NICE)){
			mapList = mapService.retrieveNiceMapEntity();
			 map = EntityListConverter.toMap("com.sinosoft.ptas.control.dto.MapData", mapList,"serialVersionUID");
		}else if(type.equals(MapConstant.CENTER)){
			 mapList = mapService.retrieveCentralMapEntity();
			 map = EntityListConverter.toMap("com.sinosoft.ptas.control.dto.MapData", mapList,"serialVersionUID");
		}else if(type.equals(MapConstant.BAD)){
			 mapList = mapService.retrieveBadMapEntity();
		     map = EntityListConverter.toMap("com.sinosoft.ptas.control.dto.MapData", mapList,"serialVersionUID");
		}
		
		return new ResponseMapData(true, "返回地图信息", map);
	}
	
	/**
	 * 查询柱状图信息
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/retrieveBarGraphMap.service",method=RequestMethod.POST)
	public ResponseMapData retrieveBarGraphMap(){
		List<MapData> mapList = mapService.retrieveBarGraphMap();
		Map<String, List<?>> map = EntityListConverter.toMap("com.sinosoft.ptas.control.dto.MapData", mapList,"serialVersionUID");
		return new ResponseMapData(true, "返回柱状图信息", map);
	}
	
	
	
	

}
